import type { MaterialConsumptionModel } from './models';

import { requestClient } from '#/api/request';

/**
 * 分页查询生产用料数据集合
 * @param params 分页查询参数
 * @returns 返回查询结果
 */
export async function getMaterialConsumptionPagedListApi(params?: PageParams) {
  return requestClient.get<PaginationResult<MaterialConsumptionModel>>(
    '/mes/production/consumption/list-page',
    {
      params,
    },
  );
}

/**
 * 解绑产品用料
 * @param id 生产用料记录 Id
 * @returns 返回结果
 */
export async function unboundMaterialConsumptionApi(id: number) {
  return requestClient.put<boolean>(`/mes/production/consumption/unbound`, {
    id,
  });
}
